package com.kolakcc.loljclient.model.swing;

import java.util.ArrayList;
import java.util.Collections;

import javax.swing.ListModel;
import javax.swing.event.ListDataListener;

import com.gvaneyck.rtmp.TypedObject;
import com.kolakcc.loljclient.model.RecentGame;

public class RecentGamesListModel implements ListModel<RecentGame> {
	private ArrayList<RecentGame> data = new ArrayList<RecentGame>();

	public RecentGamesListModel(Object[] RecentGamesList) {
		for (Object game : RecentGamesList) {
			RecentGame g = new RecentGame((TypedObject) game);
			this.data.add(g);
		}
		Collections.sort(this.data);
		Collections.reverse(this.data);
	}

	public void addListDataListener(ListDataListener l) {
	}

	public RecentGame getElementAt(int index) {
		return this.data.get(index);
		/*return selectedObject.getStatistic("CHAMPIONS_KILLED") + "/"
				+ selectedObject.getStatistic("NUM_DEATHS") + "/"
				+ selectedObject.getStatistic("ASSISTS");*/
	}

	public RecentGame getGameAt(int index) {
		return this.data.get(index);
	}

	public int getSize() {
		return this.data.size();
	}

	public void removeListDataListener(ListDataListener l) {
	}
}
